package com.fruit.util;

import com.joe.utils.log.LogbackReconfigure;


public class LogBackConfig {
    /**
     * 重新配置当前logback
     *
     * @param args   参数
     * @param loader 当前loader
     */
    public static void config(String[] args, ClassLoader loader) {
        String env = "dev";
        String envKey = "logback-key";

        if (args != null && args.length != 0) {
            for (String a : args) {
                if (a.startsWith(envKey) && a.contains("=")) {
                    env = a.split("=")[1];
                }
            }
        }
        LogbackReconfigure.reconfigure(loader.getResourceAsStream("logback/" + env + ".xml"));
    }
}
